<?php
global $framework;
require_once("$framework/iservice.php");
require_once("webapp/entities/user.entity.php");
/**
 * Service to retrieve easily User data.
 * @author delormef
 */
class UserManager implements IService{
	/**
	 * create a new User in database.
	 * @param $user
	 * @return unknown_type
	 */
	function create($user){
		
	}	
	/**
	 * Retrieve an existing user in database
	 * @param $user_id
	 * @return unknown_type
	 */
	function retrieve($user_id){
		$user = new User();
		__debug(__CLASS__."::retrieve()- start : user_id=$user_id",__FILE__,__LINE__);
		$user = __entity("user",$user_id);
		__debug(__CLASS__."::retrieve()- end : return=".$user['username'],__FILE__,__LINE__);
		return $user;
	}	
	/**
	 * 
	 * @param $user
	 * @return unknown_type
	 */
	function update($user){
		__debug(__CLASS__."::update()- start : user=".$user['username'],__FILE__,__LINE__);
		//TODO fillin the update method.
		__debug(__CLASS__."::update()- end",__FILE__,__LINE__);
	}	
	/**
	 * 
	 * @param $user
	 * @return unknown_type
	 */
	function delete($user){
		__debug(__CLASS__."::delete()- start : user=".$user['username'],__FILE__,__LINE__);
		//TODO fillin the delete method.
		__debug(__CLASS__."::delete()- end",__FILE__,__LINE__);
			}	
}
?>